import request from '@/utils/request'

function url(u) {
  const prefix = '/user'
  return `${prefix}${u || ''}`
}

export function findUser(name) {
  return request({
    url: url(`/${name}/like`),
    method: 'get'
  })
}

export function findUserByDept(dept) {
  return request({
    url: `/user/${dept}/dept`,
    method: 'get'
  })
}

export function updatePassword(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: url(),
    method: 'put',
    data: data
  })
}
